const touchpad = document.getElementById('touchpad');
const socket = io('http://localhost:8080');

touchpad.addEventListener('touchstart', (event) => {
    const touch = event.touches[0];
    socket.emit('mouse', { x: touch.clientX, y: touch.clientY, action: 'down' });
});

touchpad.addEventListener('touchmove', (event) => {
    const touch = event.touches[0];
    socket.emit('mouse', { x: touch.clientX, y: touch.clientY, action: 'move' });
});

touchpad.addEventListener('touchend', (event) => {
    socket.emit('mouse', { action: 'up' });
});